package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.AuthorMapper;
import com.heima.article.service.AuthorService;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.stereotype.Service;

@Service
public class Authorimpl extends ServiceImpl<AuthorMapper, ApAuthor> implements AuthorService {

    @Override
    public ResponseResult findbyuserid(Integer id) {
        LambdaQueryWrapper<ApAuthor> wrapper = Wrappers.lambdaQuery();
        ApAuthor author = getOne(wrapper.eq(ApAuthor::getId, id));
        return ResponseResult.okResult(author);
    }

    @Override
    public ResponseResult saveapauthor(ApAuthor apAuthor) {
        save(apAuthor);
        return ResponseResult.okResult(apAuthor);
    }
}
